/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.entity.Favorites;
import com.qdu.entity.User;
import com.qdu.service.FavoritesService;
import com.qdu.service.impl.FavoritesServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Ice
 */
@WebServlet("/dff")
public class DeleteFromFavorites extends HttpServlet {

    FavoritesService favoritesService = new FavoritesServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        User user = new User();
        HttpSession session = req.getSession();
        user = (User) session.getAttribute("user");
        int uid = user.getId();// 得到该登录用户的id号

        String mbid = req.getParameter("mbid");

        Favorites favorites = new Favorites(uid, mbid);

        favoritesService.deleteFromFavorites(favorites);

        //生成响应内容，取消收藏将使用ajax发送的请求，不打算给任何响应数据，所以就没打印响应内容
    }

}
